package com.engine4cloud.tdf.supervision.controller.inner;

import com.engine4cloud.tdf.common.core.util.R;
import com.engine4cloud.tdf.common.security.annotation.Inner;
import com.engine4cloud.tdf.supervision.dto.result.AreaFenceResultDTO;
import com.engine4cloud.tdf.supervision.dto.result.JzdxElectronicCoordinateResultDTO;
import com.engine4cloud.tdf.supervision.service.JzdxElectronicFenceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 矫正对象-电子围栏管理-inner
 *
 * @author wenjie
 * @date 2024-04-22 16:05:12
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/inner/electronic/fence")
@Tag(description = "ElectronicFence", name = "矫正对象-电子围栏管理-inner")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class JzdxElectronicFenceInnerController {

    private final JzdxElectronicFenceService jzdxElectronicFenceService;

    /**
     * 查询矫正对象已有的电子围栏（包含坐标）
     *
     * @param code 矫正对象编号
     * @return R<List < JzdxElectronicCoordinateResultDTO>>
     */
    @Inner
    @Operation(summary = "矫正对象已有的电子围栏", description = "矫正对象已有的电子围栏")
    @GetMapping("/cor/list")
    public R<List<JzdxElectronicCoordinateResultDTO>> list(@Schema(description = "矫正对象编号") String code) {
        return R.ok(jzdxElectronicFenceService.findCoordinateList(code));
    }

    @Inner
    @Operation(summary = "工作人员所在行政区划的电子围栏", description = "工作人员所在行政区划的电子围栏")
    @GetMapping("/worker/find")
    public R<AreaFenceResultDTO> findAreaFence(@Schema(description = "部门id") Long deptId) {
        return R.ok(jzdxElectronicFenceService.findAreaFence(deptId));
    }
}